home *** CD-ROM | disk | FTP | other *** search
/ Over 1,000 Windows 95 Programs / Over 1000 Windows 95 Programs (Microforum) (Disc 1).iso / 1257 / cpp2spx.c_ / cpp2spx.c
C/C++ Source or Header  |  1997-04-18  |  100KB  |  2,364 lines

  1. /* EasyCODE(C++) V5.1 02.03.1995 18:05:35 */
  2. /* EasyCODE O
  3. If=vertical
  4. LevelNumbers=no
  5. LineNumbers=no
  6. ScreenFont=Courier New,,80,9220,-11,0,400,0,0,0,0,0,0,3,2,1,49
  7. PrinterFont=Courier New,,80,17414,-34,0,400,0,0,0,0,0,0,3,2,1,49
  8. LastLevelId=183 */
  9.  
  10. /* EasyCODE ( 1
  11.    cpp2spx.c */
  12.  
  13. /* EasyCODE ( 155
  14.    Includes, macros, global variables */
  15. // ********** Include header files ************
  16. #include "conv.h"                       
  17. #include "c_filt.h"
  18. #include "tabledef.h"
  19. #include <stdio.h>
  20. #include <string.h>
  21.  
  22. // ********** Definition of error messages ***********
  23. #define ERR_DOWHILE     "Unexpected EOF: DoWhile not closed"
  24. #define ERR_KEYWORD     "Illegal keyword"
  25. #define ERR_CLASS       "Unexpected EOF: Class not closed"
  26. #define ERR_CCASEBRANCH "Unexpected EOF: CCaseBranch not closed"
  27. #define ERR_DEFAULT     "Unexpected EOF: Default not closed"
  28. #define ERR_RETURN_1    "Line=...  expected"
  29. #define ERR_RETURN_2    "Unexpected EOF: Return not closed"
  30. #define ERR_EOF         "Unexpected EOF"
  31. #define ERR_NO_KEYWORD  "No keyword in line"
  32. #define ERR_COMMENT1    "Comment not closed"
  33. #define ERR_COMMENT2    "Unexpected end of comment" 
  34.  
  35. #define USAGEMSG        "Usage: %s inputfile outputfile [/l=<int>] [/c]\n"
  36.  
  37. // ********** Function declarations **********
  38. void convert(int key_nr, long Begin, long End,int line_begin, long* d_Begin, long* d_End,
  39.              int default_line, int *next_key);
  40. void C_ReadLine( char msg[]);
  41. void control_open_file (char *in_file, char *out_file, char *prog_name);
  42. int find_options (char comment[], char level[], char input[], char output[], char *prog_name);
  43.  
  44. // ********** Variables declarations **********
  45. FILE *infile, *outfile;         
  46.   //   Input/output files
  47. BOOL bInBlockOrLevelOrFunction; 
  48.   //   Flag indicating unmodified line numbers
  49. BOOL bComment;    
  50.   //   Flag indicating comment filter
  51. char i_buf[I_BUFSIZE];     
  52.   //   Variable for content of line without keyword
  53. char delimiter[2];
  54. char result[I_BUFSIZE + MAX_KEYWORDLEN + 2];
  55.   //   Variable for lines containing several text parts
  56. int line_nr, level_nr, depth; 
  57.   //   Variables for line number, level number, maximum level depth
  58. int no_next_key = NO_KEYWORD; 
  59.   //   Variable indicating no new keyword calling convert().
  60. int *inReturn;
  61.   //   Variable for calling CommentFilter indicating comment processing
  62. /* EasyCODE ) */
  63.  
  64. /* EasyCODE ( 151
  65.    C_ReadLine */
  66.  
  67. /* EasyCODE F */
  68. void C_ReadLine( char msg[])
  69. /************************************************************************************
  70. **          Function:  C_ReadLine                                                  
  71. **          Parameter: Error message
  72. ** Purpose: Read next line, count line numbers. If error occurs print
  73. **          error message and terminate program.                                   
  74. ************************************************************************************/
  75.    {
  76.    if ((ReadLine(inbuf, infile))
  77.        // Call to read function successful?
  78.       )
  79.       {
  80.       err_msg(++line_nr, msg);  // Print error message and terminate
  81.       exit(1);
  82.       }
  83.    else
  84.       {
  85.       line_nr++;    // Increment line number
  86.       }
  87.    }
  88. /* EasyCODE ) */
  89.  
  90. /* EasyCODE ( 152
  91.    convert */
  92.  
  93. /* EasyCODE F */
  94. void convert(int key_nr, long Begin, long End, int line_begin, long* d_Begin, long* d_End, 
  95.              int default_line, int *next_key)
  96.  
  97.      /**************************************************************************************
  98.      **        Function:   convert
  99.      **        Parameters: key_nr:       Keyword ID defining further processing
  100.      **                    Begin:        Start position in input file of constructs to 
  101.      **                                  be moved within Switch
  102.      **                    End:          End position in input file of constructs to
  103.      **                                  be moved within Switch
  104.      **                    line_begin:   Line number of constructs to be moved
  105.      **                    d_Begin:      Start position of Default in input file
  106.      **                    d_End:        End position of Default in input file
  107.      **                    default_line: Line number of Default
  108.      **                    next_key:     if next key is read ahead id is returned here
  109.      ** 
  110.      ** Purpose: Converts C/C++ specific constructs into SPX constructs. Some keywords
  111.      **          remain unmodified, some are replaced, and some are rearranged.
  112.      **          Line numbers are needed for error messages.
  113.      ***************************************************************************************/
  114.    {
  115.    int act_line = 0; // Actual line number
  116.    int def_line = 0; // Line number of default content
  117.    int ins_line = 0; // Line number of constructs to be inserted
  118.    int  last_key;  
  119.    //    Last keyword before current keyword
  120.    long posBegin, posEnd; 
  121.    //    Start/end position of constructs (within switch) to be moved
  122.    long posNow = 0L; 
  123.    //    Actual file position, initialization with 0
  124.    long defaultBeginNull = 0L;
  125.    long defaultEndNull = 0L;
  126.    //    File position of default
  127.    int SwitchNr = 0;
  128.    //    Number of "switch" constructs, initialization with 0
  129.    result[0] = '\0';
  130.    switch (key_nr
  131.            // Further processing depends on key
  132.           )
  133.       {
  134.       case ETF_EASYCODE   // Keyword: EasyCODE
  135.           :
  136.  
  137.          /* EasyCODE ( 161
  138.             Replace component indicator with SPX */
  139.  
  140.          /* EasyCODE :
  141.             Replace component indicator with SPX */
  142.             {
  143.             char *p = NULL;
  144.             /* EasyCODE - */
  145.             // Copy original text to result buffer
  146.             strcpy (result, inbuf);
  147.             if (// Search for delimiter in result buffer
  148.                 p = strpbrk (result, "=:;"))
  149.                {
  150.                // If found go behind delimiter
  151.                // copy "SPX" and search for 
  152.                // delimiter in original text
  153.                // after Keyword (must exist)
  154.                p++;
  155.                strcpy (p, "SPX");
  156.                p = strpbrk (inbuf, "=:;");
  157.                if (// Search for blank in
  158.                    // original text behind 
  159.                    // component indicator
  160.                    p = strchr (p, ' '))
  161.                   {
  162.                   // Append rest of text to result buffer
  163.                   strcat (result, p);
  164.                   }
  165.                }
  166.             // Write result buffer to file
  167.             StoreLine (result, outfile);
  168.             }
  169.          /* EasyCODE ) */
  170.          break;
  171.       case ETF_SHORTINFO   // Keyword: ShortInfo
  172.           :
  173.       case ETF_ENDSHORTINFO   // Keyword: EndShortInfo
  174.           :
  175.       case ETF_OPTIONS   // Keyword: Options
  176.           :
  177.       case ETF_IFLAYOUT   // Keyword: InLayout
  178.           :
  179.       case ETF_LEVELNUMBERS   // Keyword: LevelNumbers
  180.           :
  181.       case ETF_LINENUMBERS   // Keyword: LineNumbers
  182.           :
  183.       case ETF_CONSTRUCTNUMBERS   // Keyword: ConstructNumbers
  184.           :
  185.       case ETF_SCREENFONT   // Keyword: ScreenFont
  186.           :
  187.       case ETF_PRINTERFONT // Keyword: PrinterFont
  188.           :
  189.       case ETF_LASTLEVELID // Keyword: LastLevelId
  190.           :
  191.       case ETF_ENDOPTIONS // Keyword: EndOptions
  192.           :
  193.       case ETF_IF   // Keyword: If
  194.           :
  195.       case ETF_ENDIF // Keyword: EndIf
  196.           :
  197.       case ETF_WHILE // Keyword: While
  198.           :
  199.       case ETF_ENDWHILE   // Keyword: EndWhile
  200.           :
  201.       case ETF_ENDBLOCK   // Keyword: EndBlock
  202.           :
  203.       case ETF_LEVELBODY   // Keyword: LevelBody
  204.           :
  205.       case ETF_ENDLEVEL   // Keyword: EndLevel
  206.           :
  207.       case ETF_TEXT   // Keyword: Text
  208.           :
  209.       case ETF_FOR   // Keyword: For
  210.           :
  211.       case ETF_ENDFOR   // Keyword: EndFor
  212.           :
  213.          StoreLine( inbuf, outfile);  
  214.          // All keywords before remain unchanged and are written
  215.          // to the output file.
  216.          break;
  217.       case ETF_LEVEL   // Keyword: Level
  218.           :
  219.       case ETF_BLOCK   // Keyword: Block
  220.           :
  221.          StoreLine( inbuf, outfile);
  222.          bInBlockOrLevelOrFunction = TRUE;
  223.          /* Save key and set flag to take following text in 
  224.             block or level header unmodified */
  225.          break;
  226.       case ETF_LINE   // Keyword: Line
  227.           :
  228.  
  229.          /* EasyCODE ( 97
  230.             Line processing */
  231.          if ((! bComment) || (bInBlockOrLevelOrFunction)
  232.              /* No comment filtering or within block or level header */)
  233.             {
  234.             if (!*inReturn
  235.                 // Not within Return construct
  236.                )
  237.                {
  238.                StoreLine( inbuf, outfile);  // Write line unmodified
  239.                }
  240.             else
  241.                {
  242.                strcpy(result,"Line=       "); 
  243.                strcat(result, i_buf);
  244.                StoreLine(result, outfile);
  245.                // Write line unmodified but insert blanks after keyword
  246.                }
  247.             }
  248.          else
  249.             {
  250.             switch (CommentFilter( inReturn, outfile)
  251.                     /* Call function for comment filtering */)
  252.                {
  253.                case ERROR_COMMENT    /* Error in comment filtering */:
  254.                   err_msg( line_nr, ERR_COMMENT2); // Error message
  255.                   break;
  256.                case ERROR_EOF   /* Unexpected EOF */:
  257.                   err_msg( line_nr, ERR_EOF); // Error message
  258.                   break;
  259.                }
  260.             }
  261.          /* EasyCODE ) */
  262.          break;
  263.       case ETF_ENDTEXT   // Keyword: EndText
  264.           :
  265.          if (bInBlockOrLevelOrFunction
  266.              /* Within block, level, function, or class header */)
  267.             {
  268.             bInBlockOrLevelOrFunction = FALSE;
  269.             /* At end of text there is also the end of a block or level header;
  270.                reset flag - only relevant if comment filtering is enabled */
  271.             }
  272.          if ((bInBlockComment) || (bInLineComment)
  273.              /* Within block comment or end of line comment */)
  274.             {
  275.             err_msg( line_nr, ERR_COMMENT1);
  276.             /* Error message because comment not closed at end of text */
  277.             }
  278.          StoreLine( inbuf, outfile);  // Save key EndText
  279.          break;
  280.       case ETF_DUMMY   // Keyword: Dummy
  281.           :
  282.          StoreLine( inbuf, outfile);   // Save key
  283.          if (bInBlockOrLevelOrFunction
  284.              /* Within block or level header */)
  285.             {
  286.             bInBlockOrLevelOrFunction = FALSE; /* Reset flag */
  287.             }
  288.          break;
  289.       case ETF_THEN   // Keyword: Then
  290.           :
  291.          StoreLine( inbuf, outfile);   // Save key
  292.  
  293.          /* EasyCODE ( 118
  294.             Process Then branch */
  295.          C_ReadLine( ERR_EOF);         // Read next line
  296.          key_nr = GetKeyword( delimiter, i_buf);    // Extract keyword
  297.          while (((! depth) ? depth : ((depth - level_nr) < 0)) || (key_nr != ETF_ELSE)
  298.                 
  299.                 // If depth limitation not enabled loop is processd until next ETF_ELSE.
  300.                 // Otherwise loop is processed also if level is reached that is too deep.
  301.                )
  302.             {
  303.             if (key_nr == ETF_LEVEL
  304.                 // Keyword: Level ?
  305.                )
  306.                {
  307.                level_nr += 1;   // Increment level number
  308.                }
  309.             if ((! depth) || ((depth - level_nr) >= 0)
  310.                 /* No depth limitation or not reached until yet */)
  311.                {
  312.                convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  313.                // Convert actual line
  314.                }
  315.             if (depth && ((depth - level_nr) == -1) && (key_nr == ETF_LEVEL)
  316.                 // If level depth limitation is reached level header remains as statement.
  317.                )
  318.                {
  319.                C_ReadLine( ERR_EOF);                // Read next line
  320.                key_nr = GetKeyword( delimiter, i_buf);   // Extract keyword
  321.                if (key_nr == ETF_DUMMY
  322.                    // No level header ?
  323.                   )
  324.                   {
  325.                   StoreLine( "Text;\n", outfile);     // Save Text,EndText
  326.                   StoreLine( "EndText;\n", outfile);
  327.                   }
  328.                else
  329.                   {
  330.                   bInBlockOrLevelOrFunction = TRUE;   
  331.                   // Set flag because text is not filtered within level headers
  332.                   while (key_nr != ETF_ENDTEXT
  333.                          // Multiline level header
  334.                         )
  335.                      {
  336.                      convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  337.                      C_ReadLine( ERR_EOF);            
  338.                      key_nr = GetKeyword( delimiter, i_buf);
  339.                      // Save line, read next and get keyword
  340.                      }
  341.                   convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  342.                   // Convert ETF_ENDTEXT
  343.                   }
  344.                }
  345.             if (key_nr == ETF_ENDLEVEL
  346.                 // Keyword EndLevel ?
  347.                )
  348.                {
  349.                level_nr--;  // Decrement level number
  350.                }
  351.             C_ReadLine( ERR_EOF);   // Read next line and get keyword
  352.             key_nr = GetKeyword( delimiter, i_buf);
  353.             }
  354.          /* EasyCODE ) */
  355.          convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  356.           // Process Else branch
  357.          break;
  358.       case ETF_ELSE   // Keyword: Else
  359.           :
  360.  
  361.          /* EasyCODE ( 120
  362.             Process Else Branch */
  363.          StoreLine( inbuf, outfile);   // Save ETF_ELSE
  364.          C_ReadLine( ERR_EOF);         // Save next line and get keyword
  365.          key_nr = GetKeyword( delimiter, i_buf);
  366.          while (((! depth) ? depth : ((depth - level_nr) < 0)) || (key_nr != ETF_ENDIF)
  367.                 
  368.                 // If depth limitation not enabled loop is processd until next ETF_ENDIF.
  369.                 // Otherwise loop is processed also if level is reached that is too deep.
  370.                )
  371.             {
  372.             if (key_nr == ETF_LEVEL
  373.                 // Keyword: Level ?
  374.                )
  375.                {
  376.                level_nr += 1;   // Increment level number
  377.                }
  378.             if ((! depth) || ((depth - level_nr) >= 0)
  379.                 /* If no depth limitiation or not reached until yet, convert line */)
  380.                {
  381.                convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  382.                   // Convert line
  383.                }
  384.             if (depth && ((depth - level_nr) == -1) && (key_nr == ETF_LEVEL)
  385.                 // If level depth limitation is reached level header remains as statement.
  386.                )
  387.                {
  388.                C_ReadLine( ERR_EOF);                // Read next line and get keyword
  389.                key_nr = GetKeyword( delimiter, i_buf);
  390.                if (key_nr == ETF_DUMMY
  391.                    // No level header ?
  392.                   )
  393.                   {
  394.                   StoreLine( "Text;\n", outfile);     // Save Text, EndText
  395.                   StoreLine( "EndText;\n", outfile);
  396.                   }
  397.                else
  398.                   {
  399.                   bInBlockOrLevelOrFunction = TRUE;   
  400.                   // Set flag because text is not filtered within level headers
  401.                   while (key_nr != ETF_ENDTEXT
  402.                          // Multiline level header
  403.                         )
  404.                      {
  405.                      convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  406.                      C_ReadLine( ERR_EOF);                
  407.                      key_nr = GetKeyword( delimiter, i_buf);
  408.                      // Convert actual line, read next and get keyword
  409.                      }
  410.                   convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  411.                       // Convert EndText
  412.                   }
  413.                }
  414.             if (key_nr == ETF_ENDLEVEL
  415.                 // Keyword EndLevel ?
  416.                )
  417.                {
  418.                level_nr--; // Decrement level number
  419.                }
  420.             C_ReadLine( ERR_EOF);       // Read next line and get keyword
  421.             key_nr = GetKeyword( delimiter, i_buf);
  422.             }
  423.          /* EasyCODE ) */
  424.          convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  425.            // Process EndIf
  426.          break;
  427.       case ETF_WHILEBODY   // Keyword: WhileBody
  428.           :
  429.          StoreLine( inbuf, outfile);
  430.  
  431.          /* EasyCODE ( 122
  432.             Process WhileBody */
  433.          C_ReadLine( ERR_EOF);      // Read next line and get keyword
  434.          key_nr = GetKeyword( delimiter, i_buf);
  435.          while (((! depth) ? depth : ((depth - level_nr) < 0)) || (key_nr != ETF_ENDWHILE)
  436.                 
  437.                 // If depth limitation not enabled loop is processd until next ETF_ENDWHILE.
  438.                 // Otherwise loop is processed also if level is reached that is too deep.
  439.                )
  440.             {
  441.             if (key_nr == ETF_LEVEL
  442.                 // Keyword Level ?
  443.                )
  444.                {
  445.                level_nr += 1;    // Increment level number
  446.                }
  447.             if ((! depth) || ((depth - level_nr) >= 0)
  448.                 /* No depth limitation or not reached until yet */)
  449.                {
  450.                convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  451.                   // Convert line
  452.                }
  453.             if (depth && ((depth - level_nr) == -1) && (key_nr == ETF_LEVEL)
  454.                 // If level depth limitation is reached level header remains as statement.
  455.                )
  456.                {
  457.                C_ReadLine( ERR_EOF);                // Read next line and get keyword
  458.                key_nr = GetKeyword( delimiter, i_buf);
  459.                if (key_nr == ETF_DUMMY
  460.                    // No level header ?
  461.                   )
  462.                   {
  463.                   StoreLine( "Text;\n", outfile);    // Save Text, EndText
  464.                   StoreLine( "EndText;\n", outfile);
  465.                   }
  466.                else
  467.                   {
  468.                   bInBlockOrLevelOrFunction = TRUE;   
  469.                   // Set flag because text is not filtered within level headers
  470.                   while (key_nr != ETF_ENDTEXT
  471.                          // Multiline level header
  472.                         )
  473.                      {
  474.                      convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  475.                      C_ReadLine( ERR_EOF);                
  476.                      key_nr = GetKeyword( delimiter, i_buf);
  477.                      // Save line, read next and get keyword
  478.                      }
  479.                   convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  480.                      // Convert EndText
  481.                   }
  482.                }
  483.             if (key_nr == ETF_ENDLEVEL
  484.                 // Keyword EndLevel ?
  485.                )
  486.                {
  487.                level_nr--;  // Decrement level number
  488.                }
  489.             C_ReadLine( ERR_EOF);      // Read next line and get keyword
  490.             key_nr = GetKeyword( delimiter, i_buf);
  491.             }
  492.          /* EasyCODE ) */
  493.          convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  494.            // Process EndWhile
  495.          break;
  496.       case ETF_BLOCKBODY   // Schlüssel: BlockBody
  497.           :
  498.          StoreLine( inbuf, outfile);
  499.  
  500.          /* EasyCODE ( 123
  501.             Process BlockBody */
  502.          C_ReadLine( ERR_EOF);    // Read next line and get keyword
  503.          key_nr = GetKeyword( delimiter, i_buf);
  504.          while (((! depth) ? depth : ((depth - level_nr) < 0)) || (key_nr != ETF_ENDBLOCK)
  505.                 
  506.                 // If depth limitation not enabled loop is processd until next ETF_ENDBLOCK.
  507.                 // Otherwise loop is processed also if level is reached that is too deep.
  508.                )
  509.             {
  510.             if (key_nr == ETF_LEVEL
  511.                 // Keyword Level ?
  512.                )
  513.                {
  514.                level_nr += 1;    // Increment level number
  515.                }
  516.             if ((! depth) || ((depth - level_nr) >= 0)
  517.                 /* No depth limitation or not reached until yet */)
  518.                {
  519.                convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key); 
  520.                // Convert line
  521.                }
  522.             if (depth && ((depth - level_nr) == -1) && (key_nr == ETF_LEVEL)
  523.                 // If level depth limitation is reached level header remains as statement.
  524.                )
  525.                {
  526.                C_ReadLine( ERR_EOF);                // Read next line and get keyword
  527.                key_nr = GetKeyword( delimiter, i_buf);
  528.                if (key_nr == ETF_DUMMY
  529.                    // No level header ?
  530.                   )
  531.                   {
  532.                   StoreLine( "Text;\n", outfile);
  533.                   StoreLine( "EndText;\n", outfile);  // Save Text, EndText
  534.                   }
  535.                else
  536.                   {
  537.                   bInBlockOrLevelOrFunction = TRUE;   
  538.                   // Set flag because text is not filtered within level headers
  539.                   while (key_nr != ETF_ENDTEXT
  540.                          // Multiline level header
  541.                         )
  542.                      {
  543.                      convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  544.                      C_ReadLine( ERR_EOF);               
  545.                      key_nr = GetKeyword( delimiter, i_buf);
  546.                      // Save line, read next and get keyword
  547.                      }
  548.                   convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  549.                   // Convert EndText
  550.                   }
  551.                }
  552.             if (key_nr == ETF_ENDLEVEL 
  553.                 // Keyword EndLevel ?
  554.                )
  555.                {
  556.                level_nr--;  // Decrement level number
  557.                }
  558.             C_ReadLine( ERR_EOF);
  559.             key_nr = GetKeyword( delimiter, i_buf); 
  560.             // Read next line and get keyword
  561.             }
  562.          /* EasyCODE ) */
  563.          convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  564.             // Process EndBlock
  565.          break;
  566.       case ETF_FORBODY   // Keyword: ForBody
  567.           :
  568.          StoreLine( inbuf, outfile);   // Save keyword ForBody
  569.  
  570.          /* EasyCODE ( 125
  571.             Process ForBody */
  572.          C_ReadLine( ERR_EOF);    // Read next line and get keyword
  573.          key_nr = GetKeyword( delimiter, i_buf);
  574.          while (((! depth) ? depth : ((depth - level_nr) < 0)) || (key_nr != ETF_ENDFOR)
  575.                 
  576.                 // If depth limitation not enabled loop is processd until next ETF_ENDFOR.
  577.                 // Otherwise loop is processed also if level is reached that is too deep.
  578.                )
  579.             {
  580.             if (key_nr == ETF_LEVEL
  581.                 // Keyword Level ?
  582.                )
  583.                {
  584.                level_nr += 1;    // Increment level number
  585.                }
  586.             if ((! depth) || ((depth - level_nr) >= 0)
  587.                 /* No depth limitation or not reached until yet */
  588.                 )
  589.                {
  590.                convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key); 
  591.                // Convert line
  592.                }
  593.             if (depth && ((depth - level_nr) == -1) && (key_nr == ETF_LEVEL)
  594.                 // If level depth limitation is reached level header remains as statement.
  595.                 )
  596.                {
  597.                C_ReadLine( ERR_EOF);                // Read next line and get keyword
  598.                key_nr = GetKeyword( delimiter, i_buf);
  599.                if (key_nr == ETF_DUMMY
  600.                    // No level header ?
  601.                   )
  602.                   {
  603.                   StoreLine( "Text;\n", outfile);
  604.                   StoreLine( "EndText;\n", outfile);  // Save Text, EndText
  605.                   }
  606.                else
  607.                   {
  608.                   bInBlockOrLevelOrFunction = TRUE;   
  609.                   // Set flag because text is not filtered within level headers
  610.                   while (key_nr != ETF_ENDTEXT
  611.                          // Multiline level header
  612.                         )
  613.                      {
  614.                      convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  615.                      C_ReadLine( ERR_EOF);               
  616.                      key_nr = GetKeyword( delimiter, i_buf);
  617.                      // Save line, read next and get keyword
  618.                      }
  619.                   convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  620.                   // Convert EndText
  621.                   }
  622.                }
  623.             if (key_nr == ETF_ENDLEVEL 
  624.                 // Keyword EndLevel ?
  625.                )
  626.                {
  627.                level_nr--;  // Decrement level number
  628.                }
  629.             C_ReadLine( ERR_EOF);
  630.             key_nr = GetKeyword( delimiter, i_buf); 
  631.             // Read next line and get keyword
  632.             }
  633.          /* EasyCODE ) */
  634.          convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  635.           // Process EndFor
  636.          break;
  637.       case ETF_FUNCTIONBODY   // Keyword: FunctionBody
  638.           :
  639.          StoreLine("FunctionBody;\n", outfile);   
  640.                // Save new keyword: FunctionBody
  641.  
  642.          /* EasyCODE ( 126
  643.             Process FunctionBody */
  644.          C_ReadLine( ERR_EOF);    // Read next line and get keyword
  645.          key_nr = GetKeyword( delimiter, i_buf);
  646.          while (((! depth) ? depth : ((depth - level_nr) < 0)) || (key_nr != ETF_ENDFUNCTION)
  647.                 
  648.                 // If depth limitation not enabled loop is processd until next ETF_ENDFUNCTION.
  649.                 // Otherwise loop is processed also if level is reached that is too deep.
  650.                )
  651.             {
  652.             if (key_nr == ETF_LEVEL
  653.                 // Keyword Level ?
  654.                )
  655.                {
  656.                level_nr += 1;    // Increment level number
  657.                }
  658.             if ((! depth) || ((depth - level_nr) >= 0)
  659.                 /* No depth limitation or not reached until yet */
  660.                 )
  661.                {
  662.                convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  663.                // Convert line
  664.                }
  665.             if (depth && ((depth - level_nr) == -1) && (key_nr == ETF_LEVEL)
  666.                 // If level depth limitation is reached level header remains as statement.
  667.                 )
  668.                {
  669.                C_ReadLine( ERR_EOF);                // Read next line and get keyword
  670.                key_nr = GetKeyword( delimiter, i_buf);
  671.                if (key_nr == ETF_DUMMY
  672.                    // No level header ?
  673.                   )
  674.                   {
  675.                   StoreLine( "Text;\n", outfile);
  676.                   StoreLine( "EndText;\n", outfile);  // Save Text, EndText
  677.                   }
  678.                else
  679.                   {
  680.                   bInBlockOrLevelOrFunction = TRUE;   
  681.                   // Set flag because text is not filtered within level headers
  682.                   while (key_nr != ETF_ENDTEXT
  683.                          // Multiline level header
  684.                         )
  685.                      {
  686.                      convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  687.                      C_ReadLine( ERR_EOF);               
  688.                      key_nr = GetKeyword( delimiter, i_buf);
  689.                      // Save line, read next and get keyword
  690.                      }
  691.                   convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  692.                   // Convert EndText
  693.                   }
  694.                }
  695.             if (key_nr == ETF_ENDLEVEL 
  696.                 // Keyword EndLevel ?
  697.                )
  698.                {
  699.                level_nr--;  // Decrement level number
  700.                }
  701.             C_ReadLine( ERR_EOF);
  702.             key_nr = GetKeyword( delimiter, i_buf); 
  703.             // Read next line and get keyword
  704.             }
  705.          /* EasyCODE ) */
  706.          convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  707.            // Process EndFunction
  708.          break;
  709.       case ETF_CLASS    // Keyword: Class
  710.           :
  711.  
  712.          /* EasyCODE ( 23
  713.             Process Class */
  714.          StoreLine ("Frame;\n", outfile);   // Save keyword: Frame
  715.          C_ReadLine( ERR_CLASS);    // Read next line
  716.          if ((key_nr = GetKeyword( delimiter, i_buf)) == ETF_DUMMY
  717.              // Keyword Dummy ?
  718.             )
  719.             {
  720.             StoreLine ("Text;\n", outfile);         
  721.             StoreLine ("Line=class\n", outfile);
  722.             StoreLine ("EndText;\n", outfile);
  723.             // If there is no class header the frame header gets the name "class"
  724.             // to indicate that this is not a normal frame.
  725.             }
  726.          else
  727.             {
  728.             bInBlockOrLevelOrFunction = TRUE; 
  729.             convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  730.             // Set flag for disabling comment filtering
  731.             // Convert class header
  732.             }
  733.          break;
  734.          /* EasyCODE ) */
  735.       case ETF_CLASSBODY   // Keyword: ClassBody
  736.           :
  737.  
  738.          /* EasyCODE ( 24
  739.             Process ClassBody */
  740.          StoreLine ("FrameBody;\n", outfile);    // Save keyword: FrameBody 
  741.          C_ReadLine( ERR_CLASS);     // Read next line
  742.          if (((key_nr=GetKeyword(delimiter, i_buf)) != ETF_PUBLIC) &&
  743.              (key_nr != ETF_PRIVATE) &&
  744.              (key_nr != ETF_PROTECTED)
  745.              
  746.              /* If there are other constructs (even dummy) before first 
  747.                 private/public/protected, they hav to be enclosed with a frame */)
  748.             {
  749.             StoreLine ("Frame;\n", outfile);  
  750.             StoreLine ("Dummy;\n", outfile);       
  751.             StoreLine ("FrameBody;\n", outfile);
  752.             // Save keywords: Frame, Dummy, FrameBody; Frame has no header
  753.             while (((! depth) ? depth : ((depth - level_nr) < 0)) ||
  754.                    (key_nr != ETF_PROTECTED)  &&  (key_nr != ETF_PUBLIC) &&
  755.                    (key_nr != ETF_PRIVATE)    &&  (key_nr != ETF_ENDCLASSBODY)
  756.                    
  757.                    /* Whole content until keyword for private/public/protected or EndClassBody 
  758.                       are written into the frame if maximum level depth is not reached. */)
  759.                {
  760.                if (key_nr == ETF_LEVEL
  761.                    // Keyword Level ?
  762.                   )
  763.                   {
  764.                   level_nr += 1;   // Increment level number
  765.                   }
  766.                if ((! depth) || ((depth - level_nr) >= 0)
  767.                    /* No depth limitation or not reached until yet */)
  768.                   {
  769.                   convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  770.                   // Convert actual line
  771.                   }
  772.                if (depth && ((depth - level_nr) == -1) && (key_nr == ETF_LEVEL)
  773.                    // If level depth limitation is reached level header remains as statement.
  774.                   )
  775.                   {
  776.                   C_ReadLine( ERR_EOF);                // Read next line 
  777.                   key_nr = GetKeyword( delimiter, i_buf);   // Extract keyword
  778.                   if (key_nr == ETF_DUMMY
  779.                       // No level header ?
  780.                      )
  781.                      {
  782.                      StoreLine( "Text;\n", outfile);     // Save Text,EndText
  783.                      StoreLine( "EndText;\n", outfile);
  784.                      }
  785.                   else
  786.                      {
  787.                      bInBlockOrLevelOrFunction = TRUE;   
  788.                      // Set flag because text is not filtered within level headers
  789.                      while (key_nr != ETF_ENDTEXT
  790.                             // Multiline level header
  791.                            )
  792.                         {
  793.                         convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  794.                         C_ReadLine( ERR_EOF);            
  795.                         key_nr = GetKeyword( delimiter, i_buf);
  796.                         // Save line, read next and get keyword
  797.                         }
  798.                      convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  799.                      // Convert ETF_ENDTEXT
  800.                      }
  801.                   }
  802.                if (key_nr == ETF_ENDLEVEL
  803.                    // Keyword EndLevel ?
  804.                   )
  805.                   {
  806.                   level_nr--;  // Decrement level number
  807.                   }
  808.                C_ReadLine( ERR_CLASS);   // Read next line and get keyword
  809.                key_nr = GetKeyword( delimiter, i_buf);
  810.                }
  811.             StoreLine( "EndFrameBody;\n", outfile);   
  812.             StoreLine( "Text;\n", outfile);
  813.             StoreLine( "Line= \n",outfile);
  814.             StoreLine( "EndText;\n", outfile);
  815.             StoreLine( "EndFrame;\n", outfile);
  816.             // Close frame construct and save EndFrameBody, Text, Line= , EndText, EndFrame
  817.             }
  818.          while (key_nr != ETF_ENDCLASSBODY
  819.                 // While keyword not EndClassBody
  820.                )
  821.             {
  822.             convert( key_nr, 0, 0,0, &defaultBeginNull,&defaultEndNull,0,next_key);
  823.             key_nr = *next_key;
  824.             // Recursive call for private/public/protected, in parameter next_key 
  825.             // the read keyword is returned
  826.             }
  827.          convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  828.          // Convert EndClassBody
  829.          break;
  830.          /* EasyCODE ) */
  831.       case ETF_PUBLIC   // Keyword: Public
  832.           :
  833.  
  834.          /* EasyCODE ( 25
  835.             Process Public */
  836.          StoreLine ("Frame;\n", outfile);
  837.          StoreLine ("Text;\n", outfile);
  838.          StoreLine ("Line=public\n", outfile);
  839.          StoreLine ("EndText;\n", outfile);
  840.          StoreLine ("FrameBody;\n", outfile);
  841.          // Save frame with header: public;
  842.          //      Frame/Text/Line=public/EndText/FrameBody
  843.          /* EasyCODE - */
  844.          C_ReadLine( ERR_CLASS);  // Read next line
  845.          last_key = key_nr;       // Save old keyword
  846.          while (((! depth) ? depth : ((depth - level_nr) < 0)) ||
  847.                 ((key_nr=GetKeyword(delimiter, i_buf)) != ETF_PUBLIC) &&
  848.                 (key_nr != ETF_PRIVATE)  && 
  849.                 (key_nr != ETF_PROTECTED) && 
  850.                 (key_nr != ETF_ENDCLASSBODY)
  851.                 
  852.                 // If depth limitation not enabled loop is processd until next public/private/
  853.                 // protected/EndClassBody. Otherwise loop is processed also if level is reached
  854.                 // that is too deep.
  855.                )
  856.             {
  857.             last_key = key_nr;  // Save old keyword
  858.             if (key_nr == ETF_LEVEL
  859.                 // Keyword Level ?
  860.                )
  861.                {
  862.                level_nr += 1;   // Increment level number
  863.                }
  864.             if ((! depth) || ((depth - level_nr) >= 0)
  865.                 /* No depth limitation or not reached until yet */)
  866.                {
  867.                convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  868.                // Convert actual line
  869.                }
  870.             if (depth && ((depth - level_nr) == -1) && (key_nr == ETF_LEVEL)
  871.                 // If level depth limitation is reached level header remains as statement.
  872.                )
  873.                {
  874.                C_ReadLine( ERR_EOF);                // Read next line 
  875.                key_nr = GetKeyword( delimiter, i_buf);   // Extract keyword
  876.                if (key_nr == ETF_DUMMY
  877.                    // No level header ?
  878.                   )
  879.                   {
  880.                   StoreLine( "Text;\n", outfile);     // Save Text,EndText
  881.                   StoreLine( "EndText;\n", outfile);
  882.                   }
  883.                else
  884.                   {
  885.                   bInBlockOrLevelOrFunction = TRUE;   
  886.                   // Set flag because text is not filtered within level headers
  887.                   while (key_nr != ETF_ENDTEXT
  888.                          // Multiline level header
  889.                         )
  890.                      {
  891.                      convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  892.                      C_ReadLine( ERR_EOF);            
  893.                      key_nr = GetKeyword( delimiter, i_buf);
  894.                      // Save line, read next and get keyword
  895.                      }
  896.                   convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  897.                   // Convert ETF_ENDTEXT
  898.                   }
  899.                }
  900.             if (key_nr == ETF_ENDLEVEL
  901.                 // Keyword EndLevel ?
  902.                )
  903.                {
  904.                level_nr--;  // Decrement level number
  905.                }
  906.             C_ReadLine( ERR_CLASS);   // Read next line and get keyword
  907.             key_nr = GetKeyword( delimiter, i_buf);
  908.             }
  909.          if (last_key == ETF_PUBLIC
  910.              // If old keyword was ETF_PUBLIC a dummy has to follow FrameBody
  911.             )
  912.             {
  913.             StoreLine("Dummy;\n", outfile);   // Save Dummy;
  914.             }
  915.          StoreLine( "EndFrameBody;\n", outfile);
  916.          StoreLine( "Text;\n", outfile);
  917.          StoreLine( "Line= \n",outfile);
  918.          StoreLine( "EndText;\n", outfile);
  919.          StoreLine( "EndFrame;\n", outfile);
  920.          *next_key = key_nr;
  921.          // Close frame construct and save EndFrameBody, Text, 
  922.          // Line= , EndText, EndFrame
  923.          // In next_key read ahead key is passed
  924.          break;
  925.          /* EasyCODE ) */
  926.       case ETF_PROTECTED   // Keyword: protected
  927.           :
  928.  
  929.          /* EasyCODE ( 26
  930.             Process Protected */
  931.          StoreLine ("Frame;\n", outfile);
  932.          StoreLine ("Text;\n", outfile);
  933.          StoreLine ("Line=protected\n", outfile);
  934.          StoreLine ("EndText;\n", outfile);
  935.          StoreLine ("FrameBody;\n", outfile);
  936.          // Save frame with header: protected;
  937.          /* EasyCODE - */
  938.          C_ReadLine( ERR_CLASS);  // Read next line
  939.          last_key = key_nr;       // Save old keyword
  940.          while (((! depth) ? depth : ((depth - level_nr) < 0)) ||
  941.                 ((key_nr=GetKeyword(delimiter, i_buf)) != ETF_PUBLIC) &&
  942.                 (key_nr != ETF_PRIVATE)  && 
  943.                 (key_nr != ETF_PROTECTED) && 
  944.                 (key_nr != ETF_ENDCLASSBODY)
  945.                 
  946.                 // If depth limitation not enabled loop is processd until next public/private/
  947.                 // protected/EndClassBody. Otherwise loop is processed also if level is reached
  948.                 // that is too deep.
  949.                )
  950.             {
  951.             last_key = key_nr;    // Save old keyword
  952.             if (key_nr == ETF_LEVEL
  953.                 // Keyword Level ?
  954.                )
  955.                {
  956.                level_nr += 1;   // Increment level number
  957.                }
  958.             if ((! depth) || ((depth - level_nr) >= 0)
  959.                 /* No depth limitation or not reached until yet */)
  960.                {
  961.                convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  962.                // Convert actual line
  963.                }
  964.             if (depth && ((depth - level_nr) == -1) && (key_nr == ETF_LEVEL)
  965.                 // If level depth limitation is reached level header remains as statement.
  966.                )
  967.                {
  968.                C_ReadLine( ERR_EOF);                // Read next line 
  969.                key_nr = GetKeyword( delimiter, i_buf);   // Extract keyword
  970.                if (key_nr == ETF_DUMMY
  971.                    // No level header ?
  972.                   )
  973.                   {
  974.                   StoreLine( "Text;\n", outfile);     // Save Text,EndText
  975.                   StoreLine( "EndText;\n", outfile);
  976.                   }
  977.                else
  978.                   {
  979.                   bInBlockOrLevelOrFunction = TRUE;   
  980.                   // Set flag because text is not filtered within level headers
  981.                   while (key_nr != ETF_ENDTEXT
  982.                          // Multiline level header
  983.                         )
  984.                      {
  985.                      convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  986.                      C_ReadLine( ERR_EOF);            
  987.                      key_nr = GetKeyword( delimiter, i_buf);
  988.                      // Save line, read next and get keyword
  989.                      }
  990.                   convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  991.                   // Convert ETF_ENDTEXT
  992.                   }
  993.                }
  994.             if (key_nr == ETF_ENDLEVEL
  995.                 // Keyword EndLevel ?
  996.                )
  997.                {
  998.                level_nr--;  // Decrement level number
  999.                }
  1000.             C_ReadLine( ERR_CLASS);   // Read next line and get keyword
  1001.             key_nr = GetKeyword( delimiter, i_buf);
  1002.             }
  1003.          if (last_key == ETF_PROTECTED
  1004.              // If old keyword was ETF_PROTECTEF a dummy has to follow FrameBody
  1005.             )
  1006.             {
  1007.             StoreLine("Dummy;\n", outfile);       // Save Dummy;
  1008.             }
  1009.          StoreLine( "EndFrameBody;\n", outfile);
  1010.          StoreLine( "Text;\n", outfile);
  1011.          StoreLine( "Line= \n",outfile);
  1012.          StoreLine( "EndText;\n", outfile);
  1013.          StoreLine( "EndFrame;\n", outfile);
  1014.          *next_key = key_nr;
  1015.          // Close frame construct and save EndFrameBody, Text, 
  1016.          // Line= , EndText, EndFrame
  1017.          // In next_key read ahead key is passed
  1018.          break;
  1019.          /* EasyCODE ) */
  1020.       case ETF_PRIVATE   // Keyword: Private
  1021.           :
  1022.  
  1023.          /* EasyCODE ( 27
  1024.             Process Private */
  1025.          StoreLine ("Frame;\n", outfile);
  1026.          StoreLine ("Text;\n", outfile);
  1027.          StoreLine ("Line=private\n", outfile);
  1028.          StoreLine ("EndText;\n", outfile);
  1029.          StoreLine ("FrameBody;\n", outfile);
  1030.          // Save frame with header: private
  1031.          /* EasyCODE - */
  1032.          C_ReadLine( ERR_CLASS);  // Read next line
  1033.          last_key = key_nr;       // Save old keyword
  1034.          while (((! depth) ? depth : ((depth - level_nr) < 0)) ||
  1035.                 ((key_nr=GetKeyword(delimiter, i_buf)) != ETF_PUBLIC) &&
  1036.                 (key_nr != ETF_PRIVATE)  && 
  1037.                 (key_nr != ETF_PROTECTED) && 
  1038.                 (key_nr != ETF_ENDCLASSBODY)
  1039.                 
  1040.                 // If depth limitation not enabled loop is processd until next public/private/
  1041.                 // protected/EndClassBody. Otherwise loop is processed also if level is reached
  1042.                 // that is too deep.
  1043.                )
  1044.             {
  1045.             last_key = key_nr;   // Save old keyword
  1046.             if (key_nr == ETF_LEVEL
  1047.                 // Keyword Level ?
  1048.                )
  1049.                {
  1050.                level_nr += 1;   // Increment level number
  1051.                }
  1052.             if ((! depth) || ((depth - level_nr) >= 0)
  1053.                 /* No depth limitation or not reached until yet */)
  1054.                {
  1055.                convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  1056.                // Convert actual line
  1057.                }
  1058.             if (depth && ((depth - level_nr) == -1) && (key_nr == ETF_LEVEL)
  1059.                 // If level depth limitation is reached level header remains as statement.
  1060.                )
  1061.                {
  1062.                C_ReadLine( ERR_EOF);                // Read next line 
  1063.                key_nr = GetKeyword( delimiter, i_buf);   // Extract keyword
  1064.                if (key_nr == ETF_DUMMY
  1065.                    // No level header ?
  1066.                   )
  1067.                   {
  1068.                   StoreLine( "Text;\n", outfile);     // Save Text,EndText
  1069.                   StoreLine( "EndText;\n", outfile);
  1070.                   }
  1071.                else
  1072.                   {
  1073.                   bInBlockOrLevelOrFunction = TRUE;   
  1074.                   // Set flag because text is not filtered within level headers
  1075.  
  1076.                   while (key_nr != ETF_ENDTEXT
  1077.                          // Multiline level header
  1078.                         )
  1079.                      {
  1080.                      convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  1081.                      C_ReadLine( ERR_EOF);            
  1082.                      key_nr = GetKeyword( delimiter, i_buf);
  1083.                      // Save line, read next and get keyword
  1084.                      }
  1085.                   convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  1086.                   // Convert ETF_ENDTEXT
  1087.                   }
  1088.                }
  1089.             if (key_nr == ETF_ENDLEVEL
  1090.                 // Keyword EndLevel ?
  1091.                )
  1092.                {
  1093.                level_nr--;  // Decrement level number
  1094.                }
  1095.             C_ReadLine( ERR_CLASS);   // Read next line and get keyword
  1096.             key_nr = GetKeyword( delimiter, i_buf);
  1097.             }
  1098.          if (last_key == ETF_PRIVATE
  1099.              // If old keyword was ETF_PRIVATE a dummy has to follow FrameBody
  1100.             )
  1101.             {
  1102.             StoreLine("Dummy;\n", outfile);  // Save Dummy
  1103.             }
  1104.          StoreLine( "EndFrameBody;\n", outfile);
  1105.          StoreLine( "Text;\n", outfile);
  1106.          StoreLine( "Line= \n",outfile);
  1107.          StoreLine( "EndText;\n", outfile);
  1108.          StoreLine( "EndFrame;\n", outfile);
  1109.          *next_key = key_nr;
  1110.          // Close frame construct and save EndFrameBody, Text, 
  1111.          // Line= , EndText, EndFrame
  1112.          // In next_key read ahead key is passed
  1113.          break;
  1114.          /* EasyCODE ) */
  1115.       case ETF_ENDCLASSBODY   // Keyword: EndClassBody
  1116.           :
  1117.          StoreLine( "EndFrameBody;\n", outfile);    // Save keyword EndFrameBody
  1118.          break;
  1119.       case ETF_ENDCLASS    // Keyword: EndClass
  1120.           :
  1121.          StoreLine( "EndFrame;\n", outfile);   // Save keyword EndFrame
  1122.          break;
  1123.       case ETF_DOWHILE    // Keyword: DoWhile
  1124.           :
  1125.          StoreLine("Repeat;\n", outfile);   // Save keyword Repeat
  1126.  
  1127.          /* EasyCODE ( 137
  1128.             Process DoWhile */
  1129.          C_ReadLine( ERR_EOF);         // Read next line
  1130.          key_nr = GetKeyword( delimiter, i_buf);    // Extrahieren des Schlüsselwortes
  1131.          while (((! depth) ? depth : ((depth - level_nr) < 0)) || (key_nr != ETF_UNTIL)
  1132.                 
  1133.                 // If depth limitation not enabled loop is processd until next ETF_UNTIL.
  1134.                 // Otherwise loop is processed also if level is reached that is too deep.
  1135.                )
  1136.             {
  1137.             if (key_nr == ETF_LEVEL
  1138.                 // Keyword Level ?
  1139.                )
  1140.                {
  1141.                level_nr += 1;   // Increment level number
  1142.                }
  1143.             if ((! depth) || ((depth - level_nr) >= 0)
  1144.                 /* No depth limitation or not reached until yet */)
  1145.                {
  1146.                convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  1147.                // Convert actual line
  1148.                }
  1149.             if (depth && ((depth - level_nr) == -1) && (key_nr == ETF_LEVEL)
  1150.                 // If level depth limitation is reached level header remains as statement.
  1151.                )
  1152.                {
  1153.                C_ReadLine( ERR_EOF);                // Read next line 
  1154.                key_nr = GetKeyword( delimiter, i_buf);   // Extract keyword
  1155.                if (key_nr == ETF_DUMMY
  1156.                    // No level header ?
  1157.                   )
  1158.                   {
  1159.                   StoreLine( "Text;\n", outfile);     // Save Text,EndText
  1160.                   StoreLine( "EndText;\n", outfile);
  1161.                   }
  1162.                else
  1163.                   {
  1164.                   bInBlockOrLevelOrFunction = TRUE;   
  1165.                   // Set flag because text is not filtered within level headers
  1166.                   while (key_nr != ETF_ENDTEXT
  1167.                          // Multiline level header
  1168.                         )
  1169.                      {
  1170.                      convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  1171.                      C_ReadLine( ERR_EOF);            
  1172.                      key_nr = GetKeyword( delimiter, i_buf);
  1173.                      // Save line, read next and get keyword
  1174.                      }
  1175.                   convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  1176.                   // Convert ETF_ENDTEXT
  1177.                   }
  1178.                }
  1179.             if (key_nr == ETF_ENDLEVEL
  1180.                 // Keyword EndLevel ?
  1181.                )
  1182.                {
  1183.                level_nr--;  // Decrement level number
  1184.                }
  1185.             C_ReadLine( ERR_EOF);   // Read next line and get keyword
  1186.             key_nr = GetKeyword( delimiter, i_buf);
  1187.             }
  1188.          /* EasyCODE ) */
  1189.          convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);   
  1190.           // Process Until
  1191.          break;
  1192.       case ETF_UNTIL   // Keyword: Until
  1193.           :
  1194.  
  1195.          /* EasyCODE ( 28
  1196.             Process Until */
  1197.          StoreLine( inbuf, outfile);       // Save line
  1198.          StoreLine( "Not;\n", outfile);    /* Invert do-while condition in Repeat loop */
  1199.          /* EasyCODE - */
  1200.          C_ReadLine( ERR_DOWHILE);  // Read next line
  1201.          switch (GetKeyword( delimiter, i_buf)
  1202.                  // Keyword
  1203.                 )
  1204.             {
  1205.             case ETF_DUMMY   // Keyword: ETF_DUMMY
  1206.                 :
  1207.                StoreLine( "Dummy;\n",outfile);    // Save Dummy
  1208.                break;
  1209.             case ETF_TEXT   // Keyword: ETF_TEXT
  1210.                 :
  1211.                convert( ETF_TEXT,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  1212.                C_ReadLine( ERR_DOWHILE);
  1213.                // Convert actual line and read next
  1214.                while ((key_nr = GetKeyword( delimiter, i_buf)) == ETF_LINE
  1215.                       // While keyword ETF_LINE
  1216.                      )
  1217.                   {
  1218.                   convert( ETF_LINE,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  1219.                   C_ReadLine( ERR_DOWHILE);
  1220.                   // Convert line and read next
  1221.                   }
  1222.                if (key_nr == ETF_ENDTEXT
  1223.                    // Next keyword ETF_ENDTEXT ?
  1224.                   )
  1225.                   {
  1226.                   StoreLine ("EndText;\n", outfile);   // Save EndText
  1227.                   }
  1228.                else
  1229.                   {
  1230.                   err_msg(line_nr, ERR_KEYWORD);
  1231.                   exit(1);  // Error message and termination
  1232.                   }
  1233.                break;
  1234.             default:
  1235.                err_msg(line_nr, ERR_KEYWORD);
  1236.                exit(1);   // Error message and termination
  1237.                break;
  1238.             }
  1239.          StoreLine( "EndNot;\n", outfile);   // Save EndNot
  1240.          break;
  1241.          /* EasyCODE ) */
  1242.       case ETF_ENDDOWHILE    // Keyword: EndDoWhile
  1243.           :
  1244.          StoreLine("EndRepeat;\n", outfile);   // Save EndRepeat
  1245.          break;
  1246.       case ETF_BREAK   // Keyword: Break
  1247.           :
  1248.          StoreLine( "WhenExit;\n", outfile);     
  1249.          StoreLine( "Dummy;\n", outfile);
  1250.          StoreLine( "EndWhenExit;\n", outfile);
  1251.          // Convert Break -> WhenExit, Dummy, EndWhenExit and save keywords
  1252.          break;
  1253.       case ETF_CONTINUE   // Keyword: Continue
  1254.           :
  1255.          StoreLine( "Text;\n", outfile);
  1256.          StoreLine( "Line=Continue\n", outfile);
  1257.          StoreLine( "EndText;\n", outfile);
  1258.          // Convert Continue -> Text, Line=Continue, EndText
  1259.          break;
  1260.       case ETF_CSWITCH   // Keyword: CSwitch
  1261.           :
  1262.          StoreLine("Loop;\n", outfile);
  1263.          StoreLine("OnSelector;\n", outfile);
  1264.          // Save keyword Loop, OnSelector
  1265.          break;
  1266.       case ETF_CSWITCHBODY   // Keyword: CSwitchBody
  1267.           :
  1268.  
  1269.          /* EasyCODE ( 36
  1270.             Process CSwitchBody */
  1271.          StoreLine("OnSelectorList;\n", outfile);  // Save keyword OnSelectorList
  1272.          posBegin = TellPos( infile);    // Save actual file pointer
  1273.          C_ReadLine( ERR_CCASEBRANCH);   // Read next line
  1274.          if ((key_nr = GetKeyword( delimiter, i_buf)) == ETF_CCASEBRANCH
  1275.              /* First case branch ? */)
  1276.             {
  1277.             posBegin = 0L;   // Reset file position
  1278.             while (key_nr != ETF_ENDCSWITCH
  1279.                    // While keyword not EndCSwitch
  1280.                   )
  1281.                {
  1282.                switch (key_nr
  1283.                        // Which keyword ?
  1284.                       )
  1285.                   {
  1286.                   case ETF_CCASEBRANCH   // Keyword: CCaseBranch
  1287.                       :
  1288.                      while (key_nr != ETF_CCASEBRANCHBODY
  1289.                             // Loop to process value of CASEBRANCHES: 
  1290.                             // TEXT/LINE/ENDTEXT or DUMMY.
  1291.                            )
  1292.                         {
  1293.                         convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  1294.                         C_ReadLine( ERR_CCASEBRANCH);
  1295.                         key_nr = GetKeyword( delimiter, i_buf);
  1296.                         // Save line, read next and get keyword
  1297.                         }
  1298.                      convert(key_nr, posBegin, posEnd,ins_line,&defaultBeginNull,&defaultEndNull,0,next_key);
  1299.                      key_nr = *next_key;
  1300.                      // Convert CaseBranch and get next key in variable next_key
  1301.                      break;
  1302.                   case ETF_DEFAULT:
  1303.                      def_line = line_nr;      // Save line number of default
  1304.                      convert ( key_nr, 0,0,0, d_Begin, d_End,0, &no_next_key);   
  1305.                          // Call for reading default branch
  1306.                      C_ReadLine( ERR_CCASEBRANCH);
  1307.                      key_nr = GetKeyword( delimiter, i_buf);
  1308.                      // Read next line and get keyword
  1309.                      break;
  1310.                   default:
  1311.                      err_msg( line_nr, ERR_KEYWORD);   // Error message and termination
  1312.                      exit(1);
  1313.                      break;
  1314.                   }
  1315.                }
  1316.             if (*d_Begin
  1317.                 // default branch found
  1318.                )
  1319.                {
  1320.                convert( ETF_DEFAULT,0,0,0,d_Begin,d_End,def_line, &no_next_key);
  1321.                // Convert Default
  1322.                }
  1323.             else
  1324.                {
  1325.                StoreLine("OnSelectorRest;\n",outfile);
  1326.                StoreLine("OnSelectorBranch;\n", outfile);
  1327.                StoreLine("Dummy;\n", outfile);
  1328.                StoreLine("OnSelectorBranchBody;\n", outfile);
  1329.                StoreLine("WhenExit;\n", outfile);
  1330.                StoreLine("Dummy;\n", outfile);
  1331.                StoreLine("EndWhenExit;\n", outfile);
  1332.                StoreLine("EndOnSelectorBranch;\n", outfile);
  1333.                // Save empty otherwise branch
  1334.                }
  1335.             convert(ETF_ENDCSWITCH, 0,0,0,&defaultBeginNull,&defaultEndNull,0, &no_next_key);
  1336.             // Convert EndCSwitch
  1337.             }
  1338.          else
  1339.             {
  1340.             if (key_nr == ETF_CSWITCH
  1341.                 // Next construct after SwitchBody: CSwitch ?
  1342.                )
  1343.                {
  1344.                SwitchNr += 1;  // Increment Switch number
  1345.                }
  1346.  
  1347.             /* EasyCODE ( 37
  1348.                Read until case branch or default branch */
  1349.             posEnd = 0L;   // Reset actual end position
  1350.             ins_line = line_nr - 1;   // Save line number
  1351.             while (((key_nr != ETF_CCASEBRANCH) && (key_nr != ETF_DEFAULT)) || ( SwitchNr)
  1352.                    
  1353.                    /* Read until a CCASEBRANCH is found, but only on the same level.
  1354.                    I.e. if there are further nested Switches, their case branches are not
  1355.                    recognized in this outer Switch.
  1356.                    Program enters read loop, if no CCASEBRANCH is read and position is
  1357.                    in a nested Switch. */)
  1358.                {
  1359.                posEnd = TellPos( infile);      // Save actual file position
  1360.                C_ReadLine( ERR_CCASEBRANCH);   // Read next line
  1361.                switch ((key_nr = GetKeyword( delimiter, i_buf))
  1362.                        // Further keys - to count further Switches
  1363.                       )
  1364.                   {
  1365.                   case ETF_CSWITCH  // Keyword: CSwitch
  1366.                       :
  1367.                      SwitchNr++;  // Increment Switch number
  1368.                      break;
  1369.                   case ETF_ENDCSWITCH   // Keyword: EndCSwitch
  1370.                       :
  1371.                      SwitchNr -= 1;   // Decrement Switch number
  1372.                      break;
  1373.                   default:
  1374.                      break;
  1375.                   }
  1376.                }
  1377.             if (! posEnd
  1378.                 // If an ETF_DEFAULT follows immediately, posEnd remains Null;
  1379.                 // posBegin has to be Null too.
  1380.                )
  1381.                {
  1382.                posBegin = 0L;  // Reset position begin
  1383.                ins_line = 0;
  1384.                }
  1385.             /* EasyCODE ) */
  1386.             if (key_nr == ETF_DEFAULT
  1387.                 // Keyword Default
  1388.                )
  1389.                {
  1390.                def_line = line_nr;   // Save line number of default
  1391.                convert(ETF_DEFAULT, 0,0,0, d_Begin, d_End,0, &no_next_key);     
  1392.                // Read Default and save Default begin und end position
  1393.                /* EasyCODE - */
  1394.                C_ReadLine( ERR_CCASEBRANCH);    // Read next line and get keyword
  1395.                key_nr = GetKeyword( delimiter, i_buf);
  1396.                switch (key_nr
  1397.                        // Dependent on keyword
  1398.                       )
  1399.                   {
  1400.                   case ETF_CCASEBRANCH     // Keyword: CCaseBranch
  1401.                       :
  1402.                      while (key_nr != ETF_ENDCSWITCH
  1403.                             // While not EndCSwitch
  1404.                            )
  1405.                         {
  1406.                         while (key_nr != ETF_CCASEBRANCHBODY
  1407.                                // Loop for processing CCaseBranches: 
  1408.                                // Dummy or Text/Line=../EndText
  1409.                               )
  1410.                            {
  1411.                            convert(key_nr, 0, 0,0,&defaultBeginNull,&defaultEndNull,0, &no_next_key);
  1412.                            C_ReadLine( ERR_CCASEBRANCH);
  1413.                            key_nr = GetKeyword( delimiter, i_buf);
  1414.                            // Convert line, Read next line and get keyword
  1415.                            }
  1416.                         convert( key_nr, posBegin, posEnd,ins_line,&defaultBeginNull,&defaultEndNull,0, next_key);
  1417.                         posBegin = 0L;
  1418.                         posEnd = 0L;
  1419.                         ins_line = 0;
  1420.                         key_nr = *next_key;
  1421.                         // Convert CaseBranchBodies. In first loop posBegin and posEnd of constructs
  1422.                         // to be inserted are reset. In next_key read ahead keyword is passed.
  1423.                         }
  1424.                      convert(ETF_DEFAULT,0,0,0,d_Begin,d_End,def_line,&no_next_key);
  1425.                      convert(key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  1426.                      // Call convert to write Default branch
  1427.                      // Convert EndCSwitch
  1428.                      break;
  1429.                   case ETF_ENDCSWITCH   // Keyword: EndCSwitch
  1430.                       :
  1431.                      // In this case the Switch construct only contains a Default branch
  1432.                      // In EasyCODE(SPX) there must be an of branch
  1433.                      StoreLine("OnSelectorBranch;\n", outfile);
  1434.                      StoreLine("Dummy;\n", outfile);
  1435.                      StoreLine("OnSelectorBranchBody;\n", outfile);
  1436.                      StoreLine("Dummy;\n", outfile);
  1437.                      StoreLine("EndOnSelectorBranch;\n",outfile);
  1438.                      
  1439.                      convert(ETF_DEFAULT, posBegin, posEnd,ins_line, d_Begin, d_End,def_line,&no_next_key);     
  1440.                      // Function call with keyword ETF_DEFAULT for writing
  1441.                      convert(key_nr, 0,0,0, &defaultBeginNull,&defaultEndNull,0,&no_next_key);
  1442.                      // Convert ETF_ENDCSITCH
  1443.                      break;
  1444.                   default:
  1445.                      break;
  1446.                   }
  1447.                }
  1448.             else
  1449.                {
  1450.                while (key_nr != ETF_ENDCSWITCH
  1451.                       // Loop while EndCSwitch not read
  1452.                      )
  1453.                   {
  1454.                   switch (key_nr
  1455.                           // Dependent on keyword
  1456.                          )
  1457.                      {
  1458.                      case ETF_CCASEBRANCH   // Keyword: CCaseBranch
  1459.                          :
  1460.                         while (key_nr != ETF_CCASEBRANCHBODY
  1461.                                // Loop while keyword not CCaseBranchBody
  1462.                                // Loop to process CCASEBRANCH, TEXT/LINE/ENDTEXT 
  1463.                                // or DUMMY
  1464.                               )
  1465.                            {
  1466.                            convert(key_nr, 0, 0,0,&defaultBeginNull,&defaultEndNull,0, &no_next_key);  
  1467.                            // Process actual line
  1468.                            /* EasyCODE - */
  1469.                            C_ReadLine( ERR_CCASEBRANCH);
  1470.                            key_nr = GetKeyword( delimiter, i_buf);  
  1471.                            // Read next line and get keyword
  1472.                            }
  1473.                         convert(key_nr, posBegin, posEnd,ins_line,&defaultBeginNull,&defaultEndNull,0, next_key);
  1474.                         posBegin = 0L;          
  1475.                         posEnd = 0L;
  1476.                         key_nr = *next_key;
  1477.                         // Convert actual line with keyword: CCaseBranchBody 
  1478.                         // Only in first loop posBegin and posEnd Werte may contain values,
  1479.                         // because constructs may be inserted only in first CaseBranch.
  1480.                         // Function call delivers erad aheafd key in next_key
  1481.                         break;
  1482.                      case ETF_DEFAULT    // Keyword: Default
  1483.                          :
  1484.                         def_line = line_nr;    // Save line number of Default
  1485.                         convert ( key_nr, 0,0,0, d_Begin, d_End,0, &no_next_key);   
  1486.                             // Call to read Default branch
  1487.                         C_ReadLine( ERR_CCASEBRANCH);      
  1488.                         key_nr = GetKeyword( delimiter, i_buf);
  1489.                         // Read next line and get keyword
  1490.                         break;
  1491.                      default:
  1492.                         err_msg( line_nr, ERR_KEYWORD);  
  1493.                         // Error message if any other keyword
  1494.                         break;
  1495.                      }
  1496.                   }
  1497.                if (*d_Begin
  1498.                    // Default branch contained in Switch
  1499.                   )
  1500.                   {
  1501.                   convert( ETF_DEFAULT,0,0,0,d_Begin,d_End,def_line, &no_next_key);
  1502.                   // Function call to write keyword: Default
  1503.                   }
  1504.                else
  1505.                   {
  1506.                   StoreLine("OnSelectorRest;\n",outfile);
  1507.                   StoreLine("OnSelectorBranch;\n", outfile);
  1508.                   StoreLine("Dummy;\n", outfile);
  1509.                   StoreLine("OnSelectorBranchBody;\n", outfile);
  1510.                   StoreLine("WhenExit;\n", outfile);
  1511.                   StoreLine("Dummy;\n", outfile);
  1512.                   StoreLine("EndWhenExit;\n", outfile);
  1513.                   StoreLine("EndOnSelectorBranch;\n", outfile);
  1514.                   // If no default branch contained an empty otherwise branch must be inserted
  1515.                   }
  1516.                convert(ETF_ENDCSWITCH, 0,0,0,&defaultBeginNull,&defaultEndNull,0, &no_next_key);
  1517.                // Convert EndCSwitch
  1518.                }
  1519.             }
  1520.          break;
  1521.          /* EasyCODE ) */
  1522.       case ETF_ENDCSWITCH   // Keyword: EndCSwitch
  1523.           :
  1524.          StoreLine("EndOnSelector;\n", outfile);
  1525.          StoreLine("EndLoop;\n", outfile);
  1526.          // Save EndOnSelector and EndLoop
  1527.          break;
  1528.       case ETF_CCASEBRANCH   // Keyword: CCaseBranch
  1529.           :
  1530.          StoreLine("OnSelectorBranch;\n", outfile);
  1531.          // Save new keyword OnSelectorBranch
  1532.          break;
  1533.       case ETF_CCASEBRANCHBODY    // Keyword: CCaseBranchBody
  1534.           :
  1535.  
  1536.          /* EasyCODE ( 29
  1537.             Process CCaseBranchBody */
  1538.          StoreLine("OnSelectorBranchBody;\n", outfile);   // Save new keyword: OnSelectorBranchBody
  1539.          if (Begin
  1540.              // Wenn Konstrukte einzufügen sind
  1541.             )
  1542.             {
  1543.             posNow = TellPos( infile);   // Sae actual file position in posNow
  1544.             SeekPos( Begin, infile);     // Search position of constructs to be inserted
  1545.             act_line = line_nr;      // Save actual line number
  1546.             line_nr = line_begin;    // Set line number to value of constructs to be inserted
  1547.  
  1548.             /* EasyCODE ( 52
  1549.                Insert constructs in first case branch */
  1550.             while (TellPos( infile) != End
  1551.                    // While end of position of constructs to be inserted is not reached
  1552.                   )
  1553.                {
  1554.                C_ReadLine( ERR_CCASEBRANCH); // Read next line and get keyword
  1555.                key_nr = GetKeyword( delimiter, i_buf);
  1556.                if (key_nr == ETF_LEVEL
  1557.                    // Keyword Level ?
  1558.                   )
  1559.                   {
  1560.                   level_nr += 1;    // Increment level number
  1561.                   }
  1562.                if ((! depth) || ((depth - level_nr) >= 0)
  1563.                    /* No depth limitation or not reached until yet */
  1564.                    )
  1565.                   {
  1566.                   convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key); 
  1567.                   // Convert line
  1568.                   }
  1569.                if (depth && ((depth - level_nr) == -1) && (key_nr == ETF_LEVEL)
  1570.                    // If level depth limitation is reached level header remains as statement.
  1571.                    )
  1572.                   {
  1573.                   C_ReadLine( ERR_EOF);                // Read next line and get keyword
  1574.                   key_nr = GetKeyword( delimiter, i_buf);
  1575.                   if (key_nr == ETF_DUMMY
  1576.                       // No level header ?
  1577.                      )
  1578.                      {
  1579.                      StoreLine( "Text;\n", outfile);
  1580.                      StoreLine( "EndText;\n", outfile);  // Save Text, EndText
  1581.                      }
  1582.                   else
  1583.                      {
  1584.                      bInBlockOrLevelOrFunction = TRUE;   
  1585.                      // Set flag because text is not filtered within level headers
  1586.                      while (key_nr != ETF_ENDTEXT
  1587.                             // Multiline level header
  1588.                            )
  1589.                         {
  1590.                         convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  1591.                         C_ReadLine( ERR_EOF);               
  1592.                         key_nr = GetKeyword( delimiter, i_buf);
  1593.                         // Save line, read next and get keyword
  1594.                         }
  1595.                      convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  1596.                      // Convert EndText
  1597.                      }
  1598.                   }
  1599.                if (key_nr == ETF_ENDLEVEL 
  1600.                    // Keyword EndLevel ?
  1601.                   )
  1602.                   {
  1603.                   level_nr--;  // Decrement level number
  1604.                   }
  1605.                }
  1606.             /* EasyCODE ) */
  1607.             SeekPos( posNow, infile);   // Reset file position to position in posNow
  1608.             line_nr = act_line;      // Reset actual line number
  1609.             }
  1610.          C_ReadLine( ERR_CCASEBRANCH);    // Read next line
  1611.  
  1612.          /* EasyCODE ( 54
  1613.             Process until EndCCaseBranch of case branch */
  1614.          last_key = ETF_CCASEBRANCHBODY;   
  1615.          // last_key dient zum Merken des zuletzt gelesenen (d.h. vor dem in key_nr gespeicherten) Schlüssels
  1616.          /* EasyCODE - */
  1617.          /* Lesen aller Anweisungen und Konstrukte innerhalb eines case-Zweiges */
  1618.          while ((key_nr = GetKeyword(delimiter, i_buf)) != ETF_ENDCCASEBRANCH ||
  1619.                 ((!depth) ? depth : ((depth - level_nr) < 0))
  1620.                 // While-Schleife wird durchlaufen, wenn Schlüssel nicht EndCCaseBranch ist oder
  1621.                 // wenn die zu filternde Tiefe bereits überschritten wurde
  1622.                )
  1623.             {
  1624.             if (key_nr == ETF_LEVEL
  1625.                 // Keyword Level ?
  1626.                )
  1627.                {
  1628.                level_nr += 1;   // Increment level number
  1629.                }
  1630.             if ((! depth) || ((depth - level_nr) >= 0)
  1631.                 // Solange zu filternde Tiefe nicht überschritten wurde bzw. bei 0 gibt es keine Tiefenbegrenzung
  1632.                )
  1633.                {
  1634.                if ((key_nr == ETF_DUMMY) && (last_key == ETF_CCASEBRANCHBODY)
  1635.                    // D.h. wenn case-Branch nichts enthält, darf das gelesene ETF_DUMMY nicht übernommen
  1636.                    // werden, weil anschließend ohnehin Text,Line=... , EndText
  1637.                    // mangels eines breaks hinausgeschrieben wird.
  1638.                   )
  1639.                   {
  1640.                   }
  1641.                else
  1642.                   {
  1643.                   convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  1644.                   // Convert actual line
  1645.                   }
  1646.                }
  1647.             if (depth && ((depth - level_nr) == -1) && (key_nr == ETF_LEVEL)
  1648.                 // If level depth limitation is reached level header remains as statement.
  1649.                 )
  1650.                {
  1651.                C_ReadLine( ERR_EOF);                // Read next line and get keyword
  1652.                key_nr = GetKeyword( delimiter, i_buf);
  1653.                if (key_nr == ETF_DUMMY
  1654.                    // No level header ?
  1655.                   )
  1656.                   {
  1657.                   StoreLine( "Text;\n", outfile);
  1658.                   StoreLine( "EndText;\n", outfile);  // Save Text, EndText
  1659.                   }
  1660.                else
  1661.                   {
  1662.                   bInBlockOrLevelOrFunction = TRUE;   
  1663.                   // Set flag because text is not filtered within level headers
  1664.                   while (key_nr != ETF_ENDTEXT
  1665.                          // Multiline level header
  1666.                         )
  1667.                      {
  1668.                      convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  1669.                      C_ReadLine( ERR_EOF);               
  1670.                      key_nr = GetKeyword( delimiter, i_buf);
  1671.                      // Save line, read next and get keyword
  1672.                      }
  1673.                   convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  1674.                   // Convert EndText
  1675.                   }
  1676.                }
  1677.             if (key_nr == ETF_ENDLEVEL
  1678.                 // Keyword EndLevel ?
  1679.                )
  1680.                {
  1681.                level_nr = level_nr - 1;   // Verringern der Abschnittsanzahl
  1682.                }
  1683.             last_key = key_nr;   // Merken des letzten Schlüssels, um zu wissen, ob ein break vor dem Ende des Zweiges war.
  1684.             C_ReadLine( ERR_CCASEBRANCH);   // Read next line
  1685.             }
  1686.          /* EasyCODE ) */
  1687.          /* Read ahgead next line and convert dependent on next keyword */
  1688.          C_ReadLine( ERR_CCASEBRANCH);
  1689.          switch (*next_key = GetKeyword( delimiter, i_buf)
  1690.                  // Dependent on keyword
  1691.                 )
  1692.             {
  1693.             case ETF_CCASEBRANCH   // Keyword: CCaseBranch
  1694.                 :
  1695.             case ETF_DEFAULT   // Keyword: Default
  1696.                 :
  1697.                if (last_key != ETF_BREAK
  1698.                    // Last keyword before EndCCaseBranch not Break
  1699.                   )
  1700.                   {
  1701.                   StoreLine("Text;\n", outfile);
  1702.                   StoreLine("Line=Continue with next of/otherwise-branch\n",outfile);
  1703.                   StoreLine("EndText;\n", outfile);
  1704.                   // Save Text: "Continue with next of/otherwise-branch", which
  1705.                   // indicates that the Switch construct and the Loop is not left.
  1706.  
  1707.                   }
  1708.                StoreLine("EndOnSelectorBranch;\n", outfile);
  1709.                // Save keyword EndOnSelectorBranch
  1710.                break;
  1711.             case ETF_ENDCSWITCH   // Keyword: EndSwitch
  1712.                 :
  1713.                if (last_key != ETF_BREAK
  1714.                    // Last keyword before EndCCaseBranch not Break
  1715.                   )
  1716.                   {
  1717.                   StoreLine( "WhenExit;\n", outfile);
  1718.                   StoreLine( "Dummy;\n", outfile);
  1719.                   StoreLine( "EndWhenExit;\n", outfile);
  1720.                              /* Exit Loop auch even if Case branch contains no Break, because
  1721.                                 in last branch of Switch construct it is always left. */
  1722.                   }
  1723.                StoreLine("EndOnSelectorBranch;\n", outfile);
  1724.                // Save keyword EndOnSelectorBranch
  1725.                break;
  1726.             }
  1727.          break;
  1728.          /* EasyCODE ) */
  1729.       case ETF_DEFAULT     // Keyword: Default
  1730.           :
  1731.  
  1732.          /* EasyCODE ( 30
  1733.             Process Default */
  1734.          if (*d_Begin
  1735.              // If variable contains a value call is for writing the default branch
  1736.             )
  1737.             {
  1738.             StoreLine("OnSelectorRest;\n",outfile);
  1739.             StoreLine("OnSelectorBranch;\n", outfile);
  1740.             StoreLine("Dummy;\n", outfile);
  1741.             StoreLine("OnSelectorBranchBody;\n", outfile);
  1742.             // Save keywords: OnSelectorRest,OnSelectorBranch,Dummy,OnSelectorBranchBody
  1743.             /* EasyCODE - */
  1744.             posNow = TellPos( infile);    // Save actual file position in posNow 
  1745.             act_line = line_nr;        // Save actual line number
  1746.             if (Begin
  1747.                 /* Insert statement into the first and only Switch branch, the default branch */)
  1748.                {
  1749.                SeekPos( Begin, infile);   // Set file position to start position of constructs to be inserted
  1750.                line_nr = line_begin;
  1751.  
  1752.                /* EasyCODE ( 63
  1753.                   Insert constructs into the Default branch */
  1754.                while (TellPos( infile) != End
  1755.                       // While end position of constructs to be inserted not reached
  1756.                      )
  1757.                   {
  1758.                   C_ReadLine( ERR_DEFAULT);
  1759.                   key_nr = GetKeyword( delimiter, i_buf);  // Read next line and get keyword
  1760.                   if (key_nr == ETF_LEVEL
  1761.                       // Keyword Level ?
  1762.                      )
  1763.                      {
  1764.                      level_nr += 1;    // Increment level number
  1765.                      }
  1766.                   if ((! depth) || ((depth - level_nr) >= 0)
  1767.                       /* No depth limitation or not reached until yet */
  1768.                       )
  1769.                      {
  1770.                      convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  1771.                      // Convert line
  1772.                      }
  1773.                   if (depth && ((depth - level_nr) == -1) && (key_nr == ETF_LEVEL)
  1774.                       // If level depth limitation is reached level header remains as statement.
  1775.                       )
  1776.                      {
  1777.                      C_ReadLine( ERR_EOF);                // Read next line and get keyword
  1778.                      key_nr = GetKeyword( delimiter, i_buf);
  1779.                      if (key_nr == ETF_DUMMY
  1780.                          // No level header ?
  1781.                         )
  1782.                         {
  1783.                         StoreLine( "Text;\n", outfile);
  1784.                         StoreLine( "EndText;\n", outfile);  // Save Text, EndText
  1785.                         }
  1786.                      else
  1787.                         {
  1788.                         bInBlockOrLevelOrFunction = TRUE;   
  1789.                         // Set flag because text is not filtered within level headers
  1790.                         while (key_nr != ETF_ENDTEXT
  1791.                                // Multiline level header
  1792.                               )
  1793.                            {
  1794.                            convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  1795.                            C_ReadLine( ERR_EOF);               
  1796.                            key_nr = GetKeyword( delimiter, i_buf);
  1797.                            // Save line, read next and get keyword
  1798.                            }
  1799.                         convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  1800.                         // Convert EndText
  1801.                         }
  1802.                      }
  1803.                   if (key_nr == ETF_ENDLEVEL 
  1804.                       // Keyword EndLevel ?
  1805.                      )
  1806.                      {
  1807.                      level_nr--;  // Decrement level number
  1808.                      }
  1809.                   }
  1810.                /* EasyCODE ) */
  1811.                }
  1812.             line_nr = default_line;
  1813.             SeekPos( *d_Begin, infile);    // Set start position to begin of Default branch
  1814.  
  1815.             /* EasyCODE ( 150
  1816.                Process Default content */
  1817.             while ((TellPos( infile)) !=  *d_End
  1818.                    // While end position of Default branch not reached
  1819.                   )
  1820.                {
  1821.                C_ReadLine(ERR_DEFAULT);                    // Read next line and get keyword
  1822.                key_nr = GetKeyword( delimiter, i_buf);
  1823.                if (key_nr == ETF_LEVEL
  1824.                    // Keyword Level ?
  1825.                   )
  1826.                   {
  1827.                   level_nr += 1;      // Increment level number
  1828.                   }
  1829.                if ((! depth) || ((depth - level_nr) >= 0) 
  1830.                    /* No depth limitation or not reached until yet */
  1831.                    )
  1832.                   {
  1833.                   convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  1834.                   last_key = key_nr;
  1835.                   }
  1836.                if (depth && ((depth - level_nr) == -1) && (key_nr == ETF_LEVEL)
  1837.                    // If level depth limitation is reached level header remains as statement.
  1838.                   )
  1839.                   {
  1840.                   C_ReadLine( ERR_EOF);                // Read next line and get keyword
  1841.                   key_nr = GetKeyword( delimiter, i_buf);
  1842.                   if (key_nr == ETF_DUMMY
  1843.                       // No level header ?
  1844.                      )
  1845.                      {
  1846.                      StoreLine( "Text;\n", outfile);
  1847.                      StoreLine( "EndText;\n", outfile);  // Save Text,EndText
  1848.                      }
  1849.                   else
  1850.                      {
  1851.                      bInBlockOrLevelOrFunction = TRUE;   
  1852.                      // Set flag because text is not filtered within level headers
  1853.                      while (key_nr != ETF_ENDTEXT
  1854.                             // Multiline level header
  1855.                            )
  1856.                         {
  1857.                         convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  1858.                         C_ReadLine( ERR_EOF);               
  1859.                         key_nr = GetKeyword( delimiter, i_buf);
  1860.                         // Save line, read next and get keyword
  1861.                         }
  1862.                      convert( key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0,&no_next_key);
  1863.                      // Convert EndText
  1864.                      }
  1865.                   }
  1866.                if (key_nr == ETF_ENDLEVEL
  1867.                    // Keyword EndLevel ?
  1868.                   )
  1869.                   {
  1870.                   level_nr--;  // Decrement level number
  1871.                   }
  1872.                }
  1873.             /* EasyCODE ) */
  1874.             SeekPos( posNow, infile);    // Reset file position to posNow
  1875.             line_nr = act_line;       // Reset to actual line number
  1876.             if (last_key != ETF_BREAK
  1877.                 // Last keyword before EndDefault not "Break"
  1878.                )
  1879.                {
  1880.                StoreLine( "WhenExit;\n", outfile);
  1881.                StoreLine( "Dummy;\n", outfile);
  1882.                StoreLine( "EndWhenExit;\n", outfile);
  1883.                /* In the Default branch the Loop is always left. Therefore save
  1884.                   WhenExit, Dummy, EndWhenExit */
  1885.                }
  1886.             StoreLine("EndOnSelectorBranch;\n",outfile);
  1887.             // Save EndOnSelectorBranch
  1888.             /* EasyCODE - */
  1889.             *d_Begin = 0;  // Reset Default start and end position
  1890.             *d_End = 0;
  1891.             break;
  1892.             }
  1893.          else
  1894.             {
  1895.             /* .... Read branch: Get start and end position of default branch. */
  1896.             /* Start position is after keyword: Default                        */
  1897.             /* End position is before keyword: EndDefault                      */
  1898.             
  1899.             *d_Begin = TellPos( infile);       // Start position is line after ETF_DEFAULT
  1900.             SwitchNr = 0;
  1901.             while ((SwitchNr) || (key_nr != ETF_ENDDEFAULT)
  1902.                    
  1903.                    /* Read until ETF_ENDDEFAULT. Only lines are processed that are on the same level.
  1904.                       I.e. if there are nested Switches their ENDDEFAULTs are not recognized by the 
  1905.                       outer Switch. The program enters a read loop if no ENDDEFAULT is read and if 
  1906.                       position is within nested Switch. */)
  1907.                {
  1908.                *d_End = TellPos( infile);    
  1909.                C_ReadLine( ERR_DEFAULT);
  1910.                // Save actual position as end position and read next line. When loop is left
  1911.                // the line before the keyword ETF_ENDDEFAULT remains as end position.
  1912.                switch ((key_nr = GetKeyword( delimiter, i_buf)) 
  1913.                        // Dependent on keyword
  1914.                       )
  1915.                   {
  1916.                   case ETF_CSWITCH    // Keyword: CSwitch
  1917.                       :
  1918.                      SwitchNr++;    // Increment Switch number
  1919.                      break;
  1920.                   case ETF_ENDCSWITCH   // Keyword: EndCSwitch
  1921.                       :
  1922.                      SwitchNr -= 1;   // Decrement Switch number
  1923.                      break;
  1924.                   default:
  1925.                      break;
  1926.                   }
  1927.                }
  1928.             }
  1929.          break;
  1930.          /* EasyCODE ) */
  1931.       case ETF_RETURN    // Keyword: Return
  1932.           :
  1933.  
  1934.          /* EasyCODE ( 31
  1935.             Process Return */
  1936.          C_ReadLine( ERR_RETURN_2);    // Read next line
  1937.          switch (GetKeyword( delimiter, i_buf)
  1938.                  // Dependent on keyword
  1939.                 )
  1940.             {
  1941.             case ETF_DUMMY   // Keyword: Dummy
  1942.                 :
  1943.                StoreLine("Text;\n", outfile);
  1944.                StoreLine("Line=Return\n", outfile);
  1945.                StoreLine("EndText;\n", outfile);
  1946.                // Save Text, Line=Return, EndText;
  1947.                break;
  1948.             case ETF_TEXT    // Keyword: Text
  1949.                 :
  1950.                convert( ETF_TEXT, 0, 0,0, &defaultBeginNull,&defaultEndNull,0, &no_next_key );
  1951.                C_ReadLine( ERR_RETURN_2);
  1952.                key_nr = GetKeyword (delimiter, i_buf);
  1953.                // Convert actual line, read next line
  1954.                if (key_nr == ETF_LINE
  1955.                    // Keyword Line
  1956.                   )
  1957.                   {
  1958.                   if (! bComment
  1959.                       // Comment filtering disabled
  1960.                      )
  1961.                      {
  1962.                      strcpy(result, "Line=Return ");
  1963.                      strcat(result, i_buf);
  1964.                      StoreLine( result, outfile);
  1965.                      *inReturn = 1;
  1966.                      // Assemble "Line" line to be written; before content "Return" is inserted
  1967.                      // Variable inReturn set to 1 to indicate that blanks have to be inserted 
  1968.                      // in further lines.
  1969.                      }
  1970.                   else
  1971.                      {
  1972.                      *inReturn = 2;
  1973.                      convert(key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0, &no_next_key);
  1974.                      // Variable inReturn set to 2 to indicate, that "Return" has to be inserted 
  1975.                      // in next line.
  1976.                      }
  1977.                   C_ReadLine( ERR_RETURN_2);   // Read next line
  1978.                   while ((key_nr = GetKeyword( delimiter, i_buf)) == ETF_LINE
  1979.                          // While keyword: Line
  1980.                         )
  1981.                      {
  1982.                      /* Loop if Return value is multiline */
  1983.                      convert(key_nr,0,0,0,&defaultBeginNull,&defaultEndNull,0, &no_next_key);
  1984.                      C_ReadLine( ERR_RETURN_2);
  1985.                      // Convert actual line and read next
  1986.                      }
  1987.                   if (key_nr == ETF_ENDTEXT
  1988.                       // Next keyword: EndText ?
  1989.                      )
  1990.                      {
  1991.                      if (*inReturn == 2
  1992.                          // If Variable inReturn is still 2 theat means that no line has been written
  1993.                          // by the comment filter because there was no comment.
  1994.                         )
  1995.                         {
  1996.                         StoreLine("Line=Return\n", outfile);  // Save line: Line=Return;
  1997.                         }
  1998.                      convert( key_nr, 0,0,0,&defaultBeginNull,&defaultEndNull,0, &no_next_key);
  1999.                      *inReturn = 0;
  2000.                      // Convert line with keyword EndText and reset Variable inReturn
  2001.                      }
  2002.                   else
  2003.                      {
  2004.                      err_msg( line_nr, ERR_KEYWORD);  // No EndText: Error message
  2005.                      exit(1);
  2006.                      }
  2007.                   }
  2008.                else
  2009.                   {
  2010.                   err_msg(line_nr, ERR_RETURN_1);   // No Line: Error message
  2011.                   }
  2012.                break;
  2013.             default:
  2014.                err_msg( line_nr, ERR_KEYWORD);   // Invalid keyword: Error message
  2015.                exit(1);
  2016.                break;
  2017.             }
  2018.          break;
  2019.          /* EasyCODE ) */
  2020.       case ETF_ENDRETURN    // Keyword: EndReturn
  2021.           :
  2022.          break;
  2023.       case ETF_FUNCTION   // Keyword: Function
  2024.           :
  2025.          StoreLine("Function;\n", outfile);
  2026.          bInBlockOrLevelOrFunction = TRUE;
  2027.          /* Save keyword Function and set flag to disable filtering of following text */
  2028.          break;
  2029.       case ETF_ENDFUNCTION    // Keyword: EndFunction
  2030.           :
  2031.          StoreLine("EndFunction;\n", outfile);  // Save keyword EndFunction
  2032.          break;
  2033.       case NO_KEYWORD    // Keyword: NO_KEYWORD
  2034.           :
  2035.          err_msg( line_nr, ERR_NO_KEYWORD);
  2036.          exit(1);   // Error message and termination
  2037.          break;
  2038.       case ERROR_KEYWORD    // Keyword: ERROR_KEYWORD
  2039.           :
  2040.          err_msg( line_nr, ERR_KEYWORD);
  2041.          exit(1);   // Error message and termination
  2042.          break;
  2043.       case EOF_KEYWORD    // Keyword: EOF_KEYWORD
  2044.           :
  2045.          err_msg( line_nr, ERR_EOF);
  2046.          exit(1);   // Error message and termination
  2047.          break;
  2048.       default:
  2049.          err_msg(line_nr, ERR_KEYWORD);
  2050.          exit(1);    // Error message and termination
  2051.          break;
  2052.       }
  2053.    }
  2054. /* EasyCODE ) */
  2055.  
  2056. /* EasyCODE ( 153
  2057.    control_open_file */
  2058.  
  2059. /* EasyCODE F */
  2060. void control_open_file (char *in_file, char *out_file, char *prog_name)
  2061. /***************************************************************************
  2062. **    Function:   control_open_file
  2063. **    Parameters: in_file...input file
  2064. **                out_file..output file
  2065. **                progname..program name is expected
  2066. ** Purpose: Function checks whether given files are different.
  2067. ***************************************************************************/
  2068.    {
  2069.    if (strcmp( in_file, out_file) == 0
  2070.        // Compare input and output file
  2071.       )
  2072.       {
  2073.       fprintf(stderr, USAGEMSG, prog_name);
  2074.       exit(1);
  2075.       /* Error message if equal */
  2076.       }
  2077.    else
  2078.       {
  2079.       infile = OpenInput(in_file);      // Open for reading
  2080.       outfile = OpenOutput(out_file);   // Open for writing
  2081.       }
  2082.    }
  2083. /* EasyCODE ) */
  2084.  
  2085. /* EasyCODE ( 154
  2086.    find_options */
  2087.  
  2088. /* EasyCODE F */
  2089. int find_options (char comment[], char level[], char input[], char output[], char *prog_name)
  2090. /********************************************************************************
  2091. **     Function:   find_options
  2092. **     Parameters: comment.....comment option is expected here
  2093. **                 level.......level option is expected here
  2094. **                 input.......input file is expected here
  2095. **                 output......output file is expected here
  2096. **                 progname....program name is is expected here
  2097. ** Purpose: Checks whether "/C", "/c", "-C" or "-c"  and
  2098. **          level "/L=<nr>", "/l=<nr>", "-L=<nr>" or "-l=<nr>" are contained.
  2099. **          If opening of files is successfull a postive number is returned.
  2100. ********************************************************************************/
  2101.    {
  2102.    if (( (strcmp(comment, "/c") == 0) || (strcmp(comment, "-c") == 0) ||
  2103.          (strcmp(comment, "/C") == 0) || (strcmp(comment, "-C") == 0)    ) &&
  2104.        ( ((level[0] == '/') || (level[0] == '-')) &&  
  2105.          ((level[1] == 'l') || (level[1] == 'L')) && 
  2106.          (level[2] == '=')                               )
  2107.          // Check options
  2108.       )
  2109.       {
  2110.       bComment = TRUE;         // Set flag for comment filtering.
  2111.       depth = atoi( &(level[3]) );    // Convert depth filtering option to integer.
  2112.       control_open_file( input, output, prog_name );  // Check and open files.
  2113.       return 1;
  2114.       }
  2115.    else
  2116.       {
  2117.       return 0;
  2118.       }
  2119.    }
  2120. /* EasyCODE ) */
  2121.  
  2122. /* EasyCODE ( 32
  2123.    main */
  2124.  
  2125. /* EasyCODE F */
  2126. main(argc,argv)
  2127. int argc;
  2128. char *argv[];
  2129.    {
  2130.    int  key_num;
  2131.    BOOL bEnd;
  2132.    long def_Begin = 0L;
  2133.    long def_End = 0L;
  2134.    /* EasyCODE - */
  2135.    level_nr = 0;
  2136.    depth = 0;
  2137.    bInBlockOrLevelOrFunction = FALSE;
  2138.    bComment = FALSE;
  2139.    *inReturn = 0;
  2140.    switch (argc
  2141.            // Dependent on number of arguments
  2142.           )
  2143.       {
  2144.       case 3   // 3 arguments
  2145.           :
  2146.          /* Neither comment filter nor depth limit enabled */
  2147.          /* EasyCODE - */
  2148.          control_open_file( argv[1], argv[2], argv[0] );   // Check and open files
  2149.          break;
  2150.       case 4   // 4 arguments
  2151.           :
  2152.          if ((strcmp(argv[3], "/c") == 0) ||
  2153.              (strcmp(argv[3], "-c") == 0)
  2154.              // 4th argument comment filter ?
  2155.             )
  2156.             {
  2157.             bComment = TRUE;     // Set flag for comment filter
  2158.             control_open_file( argv[1], argv[2], argv[0] );  // Check and open files
  2159.             }
  2160.          else
  2161.             {
  2162.             if (((argv[3][0] == '/') || (argv[3][0] == '-')) &&   
  2163.                  (argv[3][1] == 'l') && (argv[3][2] == '=')
  2164.                  // 4th argument Level filter ?
  2165.                )
  2166.                {
  2167.                depth = atoi( &(argv[3][3]) );
  2168.                control_open_file( argv[1], argv[2], argv[0] );
  2169.                // Convert level depth to integer, check and open files
  2170.                }
  2171.             else
  2172.                {
  2173.                if ((strcmp(argv[2], "/c") == 0) ||
  2174.                    (strcmp(argv[2], "-c") == 0)
  2175.                    // 3rd argument comment filter ?
  2176.                   )
  2177.                   {
  2178.                   bComment = TRUE;     // Set flag for comment filter
  2179.                   control_open_file( argv[1], argv[3], argv[0] );  // Check and open files
  2180.                   }
  2181.                else
  2182.                   {
  2183.                   if (((argv[2][0] == '/') || (argv[2][0] == '-')) &&   
  2184.                        (argv[2][1] == 'l') && (argv[2][2] == '=')
  2185.                        // 3rd argument Level filter ?
  2186.                      )
  2187.                      {
  2188.                      depth = atoi( &(argv[2][3]) );  // Convert level depth to integer
  2189.                      control_open_file( argv[1], argv[3], argv[0] );  // Check and open files
  2190.                      }
  2191.                   else
  2192.                      {
  2193.                      if ((strcmp(argv[1], "/c") == 0) ||
  2194.                          (strcmp(argv[1], "-c") == 0)
  2195.                          // 2nd argument comment filter ?
  2196.                         )
  2197.                         {
  2198.                         bComment = TRUE;     // Set flag for comment filter
  2199.                         control_open_file( argv[2], argv[3], argv[0] );  // Check and open files
  2200.                         }
  2201.                      else
  2202.                         {
  2203.                         if (((argv[1][0] == '/') || (argv[1][0] == '-')) &&   
  2204.                              (argv[1][1] == 'l') && (argv[1][2] == '=')
  2205.                              // 2nd argument Level filter ?
  2206.                            )
  2207.                            {
  2208.                            depth = atoi( &(argv[1][3]) );  // Convert level depth to integer
  2209.                            control_open_file( argv[2], argv[3], argv[0] );  // Check and open files
  2210.                            }
  2211.                         else
  2212.                            {
  2213.                            fprintf(stderr, USAGEMSG, argv[0]);
  2214.                            exit(1);
  2215.                            /* Depth limit needs an additional argument */
  2216.                            }
  2217.                         }
  2218.                      }
  2219.                   }
  2220.                }
  2221.             }
  2222.          break;
  2223.       case 5  // 5 arguments
  2224.           :
  2225.          if (find_options(argv[1],argv[2],argv[3],argv[4],argv[0]))
  2226.             {
  2227.             break;
  2228.             }
  2229.          if (find_options(argv[1],argv[3],argv[2],argv[4],argv[0]))
  2230.             {
  2231.             break;
  2232.             }
  2233.          if (find_options(argv[1],argv[4],argv[2],argv[3],argv[0]))
  2234.             {
  2235.             break;
  2236.             }
  2237.          if (find_options(argv[2],argv[1],argv[3],argv[4],argv[0]))
  2238.             {
  2239.             break;
  2240.             }
  2241.          if (find_options(argv[3],argv[1],argv[2],argv[4],argv[0]))
  2242.             {
  2243.             break;
  2244.             }
  2245.          if (find_options(argv[4],argv[1],argv[2],argv[3],argv[0]))
  2246.             {
  2247.             break;
  2248.             }
  2249.          if (find_options(argv[3],argv[2],argv[1],argv[4],argv[0]))
  2250.             {
  2251.             break;
  2252.             }
  2253.          if (find_options(argv[4],argv[2],argv[1],argv[3],argv[0]))
  2254.             {
  2255.             break;
  2256.             }
  2257.          if (find_options(argv[2],argv[3],argv[1],argv[4],argv[0]))
  2258.             {
  2259.             break;
  2260.             }
  2261.          if (find_options(argv[2],argv[4],argv[1],argv[3],argv[0]))
  2262.             {
  2263.             break;
  2264.             }
  2265.          if (find_options(argv[3],argv[4],argv[1],argv[2],argv[0]))
  2266.             {
  2267.             break;
  2268.             }
  2269.          if (find_options(argv[4],argv[3],argv[1],argv[2],argv[0]))
  2270.             {
  2271.             break;
  2272.             }
  2273.          else
  2274.             {
  2275.             fprintf(stderr, USAGEMSG, argv[0]);
  2276.             exit(1);
  2277.             }
  2278.       default:
  2279.          fprintf(stderr, USAGEMSG, argv[0]);
  2280.          exit(1);
  2281.          break;
  2282.       }
  2283.    line_nr = 0;   // Reset line number
  2284.  
  2285.    /* EasyCODE ( 74
  2286.       Processing loop */
  2287.    while (!(bEnd = ReadLine(inbuf, infile))
  2288.           // While not EOF
  2289.          )
  2290.       {
  2291.       ++line_nr;  // Increment line number
  2292.       key_num = GetKeyword( delimiter, i_buf);   // Read keyword
  2293.       if (key_num == ETF_LEVEL 
  2294.           // Keyword Level ?
  2295.          )
  2296.          {
  2297.          level_nr += 1;   // Increment level number
  2298.          }
  2299.       if ((! depth) || ((depth - level_nr) >= 0)
  2300.           /* If no depth limit or not reached until yet line is converted */)
  2301.          {
  2302.          convert( key_num, 0,0,0,&def_Begin,&def_End,0,&no_next_key );
  2303.          // Convert actual line
  2304.          }
  2305.       if (depth && ((depth - level_nr) == -1) && (key_num == ETF_LEVEL)
  2306.           // If level depth limitation is reached level header remains as statement.
  2307.          )
  2308.          {
  2309.          C_ReadLine( ERR_EOF);                // Read next line and get keyword
  2310.          key_num = GetKeyword( delimiter, i_buf);
  2311.          if (key_num == ETF_DUMMY
  2312.              // No level header ?
  2313.             )
  2314.             {
  2315.             StoreLine( "Text;\n", outfile);
  2316.             StoreLine( "EndText;\n", outfile);
  2317.             }
  2318.          else
  2319.             {
  2320.             bInBlockOrLevelOrFunction = TRUE;   
  2321.             // Set flag because text is not filtered within level headers
  2322.             while (key_num != ETF_ENDTEXT
  2323.                    // Multiline level header
  2324.                    // Loop until EndText
  2325.                   )
  2326.                {
  2327.                convert( key_num, 0, 0,0,&def_Begin,&def_End,0,&no_next_key);
  2328.                C_ReadLine( ERR_EOF);               
  2329.                key_num = GetKeyword( delimiter, i_buf);
  2330.                // Convert acutal line, read next line and get keyword
  2331.                }
  2332.             convert( key_num, 0, 0,0,&def_Begin,&def_End,0,&no_next_key);
  2333.             // Convert EndText
  2334.             }
  2335.          }
  2336.       if (key_num == ETF_ENDLEVEL
  2337.           // Keyword EndLevel ?
  2338.          )
  2339.          {
  2340.          level_nr--;  // Decrement level number
  2341.          }
  2342.       }
  2343.    /* EasyCODE ) */
  2344.    if (key_num != ETF_ENDLEVEL
  2345.        // Last keyword not EndLevel ?
  2346.       )
  2347.       {
  2348.       err_msg( line_nr, ERR_EOF );    // Error message
  2349.       }
  2350.    else
  2351.       {
  2352.       if (level_nr > 0
  2353.           // Level depth still greater than 0, so Level not terminated correctly
  2354.          )
  2355.          {
  2356.          err_msg( line_nr, ERR_EOF);   // Error message
  2357.          }
  2358.       }
  2359.    CloseFile(infile);   // Close input and output file
  2360.    CloseFile(outfile);
  2361.    }
  2362. /* EasyCODE ) */
  2363. /* EasyCODE ) */
  2364.